/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on Oct 30, 2011, 10:09:06 AM
 */
package Login;

import DataPenyewa.DataPenyewaPanel;
import DataMobil.*;
import java.awt.GridLayout;
import javax.swing.JScrollPane;

/**
 *
 * @author Ophin
 */
public class FormUtama extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public FormUtama() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        transaksiMenu = new javax.swing.JMenu();
        dataPenyewaItem = new javax.swing.JMenuItem();
        datapenyewaanmobilItem = new javax.swing.JMenuItem();
        datapengembalianmobilItem = new javax.swing.JMenuItem();
        viewMenu = new javax.swing.JMenu();
        jadwalpenyewaanItem = new javax.swing.JMenuItem();
        dataketersediaanmobilItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Frame Utama");
        setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        setName("Frame Utama"); // NOI18N

        jDesktopPane1.setBackground(new java.awt.Color(153, 255, 255));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login/13jufxpt-appletreeblossom.jpg"))); // NOI18N
        jLabel1.setBounds(0, 0, 400, 320);
        jDesktopPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jMenuBar1.setBackground(new java.awt.Color(255, 204, 255));

        transaksiMenu.setBackground(new java.awt.Color(255, 204, 255));
        transaksiMenu.setText("Transaksi");
        transaksiMenu.setFont(new java.awt.Font("Comic Sans MS", 1, 14));

        dataPenyewaItem.setBackground(new java.awt.Color(255, 204, 255));
        dataPenyewaItem.setFont(new java.awt.Font("Comic Sans MS", 1, 12));
        dataPenyewaItem.setText("Data Penyewa");
        dataPenyewaItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dataPenyewaItemActionPerformed(evt);
            }
        });
        transaksiMenu.add(dataPenyewaItem);

        datapenyewaanmobilItem.setBackground(new java.awt.Color(255, 204, 255));
        datapenyewaanmobilItem.setFont(new java.awt.Font("Comic Sans MS", 1, 12));
        datapenyewaanmobilItem.setText("Data Penyewaan Mobil");
        datapenyewaanmobilItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                datapenyewaanmobilItemActionPerformed(evt);
            }
        });
        transaksiMenu.add(datapenyewaanmobilItem);

        datapengembalianmobilItem.setBackground(new java.awt.Color(255, 204, 255));
        datapengembalianmobilItem.setFont(new java.awt.Font("Comic Sans MS", 1, 12));
        datapengembalianmobilItem.setText("Data Pengembalian Mobil");
        datapengembalianmobilItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                datapengembalianmobilItemActionPerformed(evt);
            }
        });
        transaksiMenu.add(datapengembalianmobilItem);

        jMenuBar1.add(transaksiMenu);

        viewMenu.setBackground(new java.awt.Color(255, 204, 255));
        viewMenu.setText("View");
        viewMenu.setFont(new java.awt.Font("Comic Sans MS", 1, 14));

        jadwalpenyewaanItem.setBackground(new java.awt.Color(255, 204, 255));
        jadwalpenyewaanItem.setFont(new java.awt.Font("Comic Sans MS", 1, 12));
        jadwalpenyewaanItem.setText("Jadwal Penyewaan");
        jadwalpenyewaanItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jadwalpenyewaanItemActionPerformed(evt);
            }
        });
        viewMenu.add(jadwalpenyewaanItem);

        dataketersediaanmobilItem.setBackground(new java.awt.Color(255, 204, 255));
        dataketersediaanmobilItem.setFont(new java.awt.Font("Comic Sans MS", 1, 12));
        dataketersediaanmobilItem.setText("Data Ketersediaan Mobil");
        dataketersediaanmobilItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dataketersediaanmobilItemActionPerformed(evt);
            }
        });
        viewMenu.add(dataketersediaanmobilItem);

        jMenuBar1.add(viewMenu);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-408)/2, (screenSize.height-347)/2, 408, 347);
    }// </editor-fold>//GEN-END:initComponents

    private void dataPenyewaItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataPenyewaItemActionPerformed
        // TODO add your handling code here:

        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new GridLayout(1, 1));
        DataPenyewaPanel penyewa = new DataPenyewaPanel();
        this.jDesktopPane1.add(penyewa);
        int h = penyewa.getPreferredSize().height + this.getPreferredSize().height - this.jDesktopPane1.getPreferredSize().height + this.jMenuBar1.getPreferredSize().height;
        this.setSize(penyewa.getPreferredSize().width, h);
        this.setLocation(100, 50);

    }//GEN-LAST:event_dataPenyewaItemActionPerformed

    private void datapenyewaanmobilItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_datapenyewaanmobilItemActionPerformed
        // TODO add your handling code here:
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new GridLayout(1, 1));
        DataPenyewaanMobilPanel penyewaanmobil = new DataPenyewaanMobilPanel();
        JScrollPane la = new JScrollPane(penyewaanmobil);
        this.jDesktopPane1.add(la);
        int j = penyewaanmobil.getPreferredSize().height + this.getPreferredSize().height - this.jDesktopPane1.getPreferredSize().height + this.jMenuBar1.getPreferredSize().height;
        this.setSize(penyewaanmobil.getPreferredSize().width, j);
        this.setLocation(300, 50);
        this.jDesktopPane1.setVisible(false);
        this.jDesktopPane1.setVisible(true);
    }//GEN-LAST:event_datapenyewaanmobilItemActionPerformed

    private void datapengembalianmobilItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_datapengembalianmobilItemActionPerformed
        // TODO add your handling code here:
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new GridLayout(1, 1));
        DataPengembalianMobilPanel kembalimobil = new DataPengembalianMobilPanel();
        JScrollPane la = new JScrollPane(kembalimobil);
        this.jDesktopPane1.add(la);
        int k = kembalimobil.getPreferredSize().height + this.getPreferredSize().height - this.jDesktopPane1.getPreferredSize().height + this.jMenuBar1.getPreferredSize().height;
        this.setSize(kembalimobil.getPreferredSize().width, k);
        this.setLocation(300, 50);
        this.jDesktopPane1.setVisible(false);
        this.jDesktopPane1.setVisible(true);
    }//GEN-LAST:event_datapengembalianmobilItemActionPerformed

    private void jadwalpenyewaanItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jadwalpenyewaanItemActionPerformed
        // TODO add your handling code here:
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new GridLayout(1, 1));
        Jadwal ss = new Jadwal();

        int j = ss.getPreferredSize().height + 2 * this.jMenuBar1.getPreferredSize().height;
        this.jDesktopPane1.add(ss);
        this.setSize(ss.getPreferredSize().width, j);
    }//GEN-LAST:event_jadwalpenyewaanItemActionPerformed

    private void dataketersediaanmobilItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dataketersediaanmobilItemActionPerformed
        // TODO add your handling code here:
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new GridLayout(1, 1));
        DataKetersediaanMobilPanel tersedia = new DataKetersediaanMobilPanel();
        this.jDesktopPane1.add(tersedia);
        int x = tersedia.getPreferredSize().height + jMenuBar1.getPreferredSize().height+30;
        this.setSize(tersedia.getPreferredSize().width,x);
//        
        
        
    }//GEN-LAST:event_dataketersediaanmobilItemActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new NewJFrame().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem dataPenyewaItem;
    private javax.swing.JMenuItem dataketersediaanmobilItem;
    private javax.swing.JMenuItem datapengembalianmobilItem;
    private javax.swing.JMenuItem datapenyewaanmobilItem;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jadwalpenyewaanItem;
    private javax.swing.JMenu transaksiMenu;
    private javax.swing.JMenu viewMenu;
    // End of variables declaration//GEN-END:variables
}
